package cn.com.lms.business.learning.service;

import cn.com.lms.business.core.constant.CourseTypeEnum;
import cn.com.lms.business.core.constant.BNZConstants;
import cn.com.lms.business.core.util.FBUtils;
import cn.com.lms.business.core.util.ServletUtils;
import cn.com.lms.business.core.util.SystemUserUtil;
import cn.com.lms.business.course.service.FbCourseInfoService;
import cn.com.lms.business.learning.persistence.entity.FbLearningPlan;
import cn.com.lms.business.learning.persistence.entity.FbLearningStage;
import cn.com.lms.business.learning.persistence.entity.vo.*;
import cn.com.lms.business.learning.persistence.repository.LearningPlanRepository;
import cn.com.lms.business.learning.persistence.repository.LearningStageDetailRepository;
import cn.com.lms.business.learning.persistence.repository.LearningStageRepository;
import cn.com.lms.business.livecourse.constant.SysSettingConstant;
import cn.com.lms.business.user.persistence.entity.SysUserVo;
import com.bnzj.cloud.business.core.persistence.repository.SysDepartmentRepository;
import com.bnzj.core.persistence.BaseService;
import com.bnzj.cloud.business.core.persistence.entity.SysDepartment;
import com.bnzj.core.export.Column;

import com.bnzj.core.persistence.query.CompareExpression;
import com.bnzj.core.persistence.query.CompareType;
import com.bnzj.core.persistence.query.IExpression;

import com.bnzj.core.persistence.query.QueryHelpBean;
import com.bnzj.core.util.FbConstant;
import com.bnzj.core.webmvc.util.WebMvcUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
public class UserLearningPlanService extends BaseService<LearningPlanRepository, FbLearningPlan, Long> {

    private static final Logger logger = LoggerFactory.getLogger(UserLearningPlanService.class);
    @Autowired
    private LearningStageRepository repository;

    @Autowired
    private LearningStageDetailRepository stageDetailRepository;
    @Autowired
    private FbCourseInfoService courseInfoService;

    @Autowired
    private SysDepartmentRepository sysDepartmentRepository;

    /*
     * @author liuwei
     * @date 2020/3/25 17:01
     * @desc 员工学习计划统计-列表
     */
    public Page<UserStatisticsListVo> queryUserStatistics(HttpServletRequest request) {
        String userName = request.getParameter("userName");
        String deptId = request.getParameter("deptId");
        String isRecord = request.getParameter("isRecord");
        String startDate = request.getParameter("startDate");
        String endDate = request.getParameter("endDate");
        Pageable pageable = WebMvcUtils.initPage(request);
        SysUserVo sysUser = SystemUserUtil.getCurrentUser();
        if (!FbConstant.ADMIN.equals(sysUser.getAccount()) && StringUtils.isEmpty(deptId)) {
            deptId = String.valueOf(sysUser.getDeptId());
        }
        SysDepartment department = null;
        if (!StringUtils.isEmpty(deptId)) {
            department = sysDepartmentRepository.getOne(Long.valueOf(deptId));
        }

        QueryHelpBean queryHelpBean = userStatisticsQuery(department == null ? "" : department.getFullName(), startDate, endDate);
//        IExpression deptIdCondition = CompareExpression.build("a.deptId", CompareType.equal, deptId);
        IExpression queryTextCondition = CompareExpression.build("a.account", CompareType.equal, userName).or(
                CompareExpression.build("a.phone", CompareType.equal, userName).or(
                        CompareExpression.build("a.identity", CompareType.equal, userName).or(
                                CompareExpression.build("a.cname", CompareType.equal, userName).or(
                                        CompareExpression.build("a.jobType", CompareType.equal, userName)))));

//        IExpression startTimeCondition = CompareExpression.build("a.releaseTime", CompareType.between, "releaseTime", startDate, endDate);
        IExpression isRecodeCondition = CompareExpression.build("a.isRecord", CompareType.equal, isRecord);
        queryHelpBean.addWhere(queryTextCondition, isRecodeCondition);
        queryHelpBean.setPageable(pageable);
        Page<UserStatisticsListVo> all1 = this.findAll(queryHelpBean);
        String sysValue = courseInfoService.getSysSettingValue(SysSettingConstant.KEY_ALLOW_DAILY_MAX_LEARN_TIME);
        all1.getContent().forEach(item -> {
            if (item.getLearningHours().intValue() > Integer.valueOf(sysValue)) {
                item.setEffectiveTime(sysValue);
            } else {
                item.setEffectiveTime(item.getLearningHours().toString());
            }
        });
        return all1;
    }

    /*
     * @author liuwei
     * @date 2020/4/7 19:09
     * @desc 员工学习统计-列表-查看
     */
    public UserLearningListCount getUserLearStatisticsView(HttpServletRequest request, Long userId) {
        String type = request.getParameter("type");
        String planName = request.getParameter("queryName");
        String startDate = request.getParameter("startDate");
        String endDate = request.getParameter("endDate");
        Pageable pageable = WebMvcUtils.initPage(request);
        QueryHelpBean queryHelpBean = userStatisticsViewQuery(userId, type, startDate, endDate);

        //获取统计汇总信息 ----start
        QueryHelpBean bean = userStatisticsViewCount(userId, planName, startDate, endDate);
        bean.setPageable(ServletUtils.initPage());
        UserLearningListCount list = this.exportAll(bean).get(0) == null ? new UserLearningListCount() : (UserLearningListCount) this.exportAll(bean).get(0);
        //获取统计汇总信息 ----end
        //查询列表数据----start
        IExpression planNameCondition = CompareExpression.build("a.plan_name", CompareType.like, planName);
//        IExpression startTimeCondition = CompareExpression.build("a.createTime", CompareType.between, "createTime", startDate, endDate);
        queryHelpBean.addWhere(planNameCondition);
        queryHelpBean.setPageable(pageable);
        Page<UserStatisticsListViewVo> all1 = this.findAll(queryHelpBean);
        list.setPage(all1);
        //查询列表数据----start
        return list;
    }

    /*
     * @author liuwei
     * @date 2020/4/8 9:24
     * @desc 员工学习统计列表-查看-详情
     */
    public List<UserLearningStageViewVo> getUserLearningStageView(Long planId, Long userId) {
        List<FbLearningStage> stageList = repository.queryStageByPlanId(planId);
        List<UserLearningStageViewVo> viewVo = new ArrayList<>();

        stageList.forEach(stage -> {
            UserLearningStageViewVo stageViewVo = new UserLearningStageViewVo();
            stageViewVo.setStageName(stage.getStageName());
            stageViewVo.setFinishNum(0);
            //查询学员阶段详情
            List<Map<String, Object>> mapList = stageDetailRepository.queryUserLearningStageView(stage.getId(), userId);
            try {
                List<UserStageDetailVo> stageDetails = FBUtils.convertListMapToListBean(mapList, UserStageDetailVo.class);
                stageDetails.forEach(item -> {
                    if (BNZConstants.FINISH_STATE.equals(item.getFinishSituation())) {
                        //已完成数量统计
                        stageViewVo.setFinishNum(stageViewVo.getFinishNum() + 1);
                    }
                    if (BNZConstants.TYPE_ONE.equals(item.getObjType())) {
                        BigDecimal learHours = new BigDecimal(item.getLearningHours());
                        BigDecimal courseTime = new BigDecimal(item.getCourseTime());
                        item.setFinishSituation(String.valueOf(learHours.divide(courseTime).multiply(new BigDecimal(100)).intValue()));
                    }
                });
                stageViewVo.setStageDetailNum(stageDetails.size());
                stageViewVo.setStageDetailVoList(stageDetails);
            } catch (Exception e) {
                logger.error(e.getMessage());
            }
            viewVo.add(stageViewVo);
        });
        return viewVo;
    }

    /*
     * @author liuwei
     * @date 2020/4/8 16:22
     * @desc 查询用户学习计划考试列表
     */
    public UserLearningListCount getUserExamList(HttpServletRequest request, Long userId) {
        String type = request.getParameter("type");
        String examName = request.getParameter("queryName");
        String startDate = request.getParameter("startDate");
        String endDate = request.getParameter("endDate");
        Pageable pageable = WebMvcUtils.initPage(request);
        QueryHelpBean queryHelpBean = QueryUserExamQuery(userId, StringUtils.isEmpty(type) ? null : Integer.valueOf(type), startDate, endDate);

        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            startDate += " 00:00:00";
            endDate += " 23:59:59";
        }
        //获取统计汇总信息
        QueryHelpBean bean = QueryUserExamCount(userId, examName, startDate, endDate);
        bean.setPageable(ServletUtils.initPage());
        UserLearningListCount list = this.exportAll(bean).get(0) == null ? new UserLearningListCount() : (UserLearningListCount) this.exportAll(bean).get(0);

        IExpression planNameCondition = CompareExpression.build("a.examName", CompareType.like, examName);
        queryHelpBean.addWhere(planNameCondition);
        queryHelpBean.setPageable(pageable);
        Page<UserExamListVo> all1 = this.findAll(queryHelpBean);
        list.setPage(all1);
        return list;
    }

    /*
     * @author liuwei
     * @date 2020/4/8 16:22
     * @desc 查询用户学习计划课程列表
     */
    public Page<UserLearningCourseListVo> getUserCourseList(HttpServletRequest request, Long userId) {
        String courseType = request.getParameter("type");
        String courseName = request.getParameter("queryName");
        String startDate = request.getParameter("startDate");
        String endDate = request.getParameter("endDate");
        Pageable pageable = WebMvcUtils.initPage(request);
        QueryHelpBean queryHelpBean = QueryUserCourseQuery(userId, startDate, endDate);

        List<Map<String, Object>> mapList = courseInfoService.getCourseTypeDictionary(BNZConstants.COURSE_TYPE_CODE);
        for (Map<String, Object> item : mapList) {
            String name = String.valueOf(item.get("name"));
            if ("0".equals(courseType) && CourseTypeEnum.VIDEO.getValue().equals(name)) {
                //课程类型为视频
                courseType = item.get(CourseTypeEnum.VIDEO.getColumn()).toString();
                break;
            }
            if ("1".equals(courseType) && CourseTypeEnum.LIVE.getValue().equals(name)) {
                //课程类型为直播
                courseType = item.get(CourseTypeEnum.LIVE.getColumn()).toString();
                break;
            }
            if ("2".equals(courseType) && CourseTypeEnum.OTHER.getValue().equals(name)) {
                //课程类型为其他
                courseType = item.get(CourseTypeEnum.OTHER.getColumn()).toString();
                break;
            }
        }

        IExpression courseTypeCondition = CompareExpression.build("a.courseType", CompareType.equal, courseType);
        IExpression planNameCondition = CompareExpression.build("a.courseName", CompareType.like, courseName);
        queryHelpBean.addWhere(planNameCondition, courseTypeCondition);
        queryHelpBean.setPageable(pageable);
        Page<UserLearningCourseListVo> all1 = this.findAll(queryHelpBean);
        return all1;
    }

    /*
     * @author liuwei
     * @date 2020/4/7 19:10
     * @desc 员工学习统计列表
     */
    public QueryHelpBean userStatisticsQuery(String deptFullName, String startDate, String endDate) {
        String selectSQL = "SELECT su.dept_id deptId,su.id,su.account,su.identity,su.phone,su.cname,lp.release_time releaseTime,sd.full_name as name,su.job_type_name jobType,su.is_record isRecord" +
                ",sum(case finish_state when 0 then 0 else learning_hours end)learningHours,c.score score, sum(case when ls.finish_state=1 and lsd.study_type=0 then 1 else 0 end) courseCount,count(DISTINCT ls.plan_id) planCount,sum(case when lsd.study_type=2 then 1 else 0 end ) examCount";
        String whereSQL = " from bnz_sys_user su inner join bnz_learning_student ls on ls.user_id=su.id left join bnz_learning_plan lp on ls.plan_id=lp.id    left join bnz_sys_department sd on sd.id=su.dept_id" +
                " left join bnz_learning_stage_detail lsd on lsd.id=ls.stage_detail_id  left join (SELECT sum(ci.score)score,ls.user_id FROM bnz_course_info ci left join bnz_learning_stage_detail lsd" +
                " on lsd.obj_id=ci.id left join bnz_learning_student ls on ls.stage_detail_id=lsd.id where lsd.study_type=0 and ls.finish_state=1 GROUP BY ls.user_id  ) c " +
                " on c.user_id=su.id where su.personnel=1 ";
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            whereSQL += " AND  lp.create_time BETWEEN '" + startDate + " 00:00:00' AND '" + endDate + " 23:59:59'";
        }
        if (!StringUtils.isEmpty(deptFullName)) {
            whereSQL += " and su.full_dept_name like '" + deptFullName + "%'";
        }
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL + " GROUP BY su.id ", "select count(DISTINCT su.id)" + whereSQL, UserStatisticsListVo.class);
        return queryBean;
    }

    /*
     * @author liuwei
     * @date 2020/4/7 19:10
     * @desc 员工学习统计列表-学习计划-查看列表SQL
     */
    public QueryHelpBean userStatisticsViewQuery(Long userId, String type, String startDate, String endDate) {
        String selectSQL = " select a.plan_name objName,a.plan_id planId,a.user_id userId,a.createTime createTime,a.releaseTime startDate,a.finishTime endDate," +
                "(a.finishCount/a.stageCount)*100 as completionNum,a.last_study_time lastStudyTime,IFNULL(a.learningHours,0) learningHours,(case when ((a.finishCount / a.stageCount )* 100)>=100 then '已完成' else '未完成' end) stateText from ";
        String whereSQL = " (select lp.plan_name,ls.plan_id,ls.user_id,lp.create_time createTime,lp.release_time releaseTime," +
                "lp.finish_time finishTime,ls.last_study_time,\n" +
                " sum(case ls.finish_state when 1 then 1 else 0 end) finishCount,\n" +
                " count(ls.stage_detail_id) stageCount,\n" +
                " (select sum(ci.course_time) from bnz_course_info ci where FIND_IN_SET(ci.id,GROUP_CONCAT(lsd.obj_id))) learningHours\n" +
                " from bnz_learning_student ls left join bnz_learning_plan lp on ls.plan_id=lp.id\n" +
                " left join bnz_learning_stage_detail lsd on lsd.id=ls.stage_detail_id\n" +
                " where ls.user_id=" + userId + " group by ls.plan_id ";

        if (BNZConstants.FINISH_STATE.equals(type)) {
            whereSQL += " HAVING finishCount = stageCount";
        }
        if (BNZConstants.UNFINISH_STATE.equals(type)) {
            whereSQL += " HAVING finishCount != stageCount";
        }
        whereSQL += " ) a where 1=1";
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            whereSQL += " and a.createTime BETWEEN '" + startDate + " 00:00:00' and  '" + endDate + " 23:59:59'";
        }
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL, "select count(1) from" + whereSQL, UserStatisticsListViewVo.class);
        return queryBean;
    }

    /*
     * @author liuwei
     * @date 2020/4/7 19:10
     * @desc 员工学习统计列表-学习计划-查看-统计SQL
     */
    public QueryHelpBean userStatisticsViewCount(Long userId, String queryName, String startDate, String endDate) {
        String selectSQL = " SELECT count(1) allCount,sum(case when finishCount = stageCount then 1 else 0 end  ) finishCount, sum(case when finishCount != stageCount then 1 else 0 end  ) unFinishCount FROM(SELECT\tlp.plan_name,ls.plan_id,sum( CASE ls.finish_state WHEN 1 THEN 1 ELSE 0 END ) finishCount,count( ls.stage_detail_id ) stageCount";
        String whereSQL = " FROM bnz_learning_student ls LEFT JOIN bnz_learning_plan lp ON ls.plan_id = lp.id LEFT JOIN bnz_learning_stage_detail lsd ON lsd.id = ls.stage_detail_id WHERE\tls.user_id = " + userId + "   ";
        if (!StringUtils.isEmpty(queryName)) {
            whereSQL += " and  lp.plan_name like '" + queryName + "%'";
        }
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            whereSQL += " and lp.create_time BETWEEN '" + startDate + " 00:00:00' and  '" + endDate + " 23:59:59'";
        }
        whereSQL += " GROUP BY ls.plan_id ) a";
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL, "select count(1) from" + whereSQL, UserLearningListCount.class);
        return queryBean;
    }


    /*
     * @author liuwei
     * @date 2020/4/8 16:04
     * @desc 查看员工学习计划考试信息列表sql
     */
    public QueryHelpBean QueryUserExamQuery(Long userId, Integer type, String startDate, String endDate) {
        String selectSQL = "select a.examName,a.userId,a.createTime, a.releaseTime startDate,a.finishTime endDate ,a.examCount,a.adoptScore,IFNULL(a.grade,0) as grade,a.lastExamTime from ";
        String whereSQL = "(SELECT ls.user_id userId,obj_name as examName,lp.release_time as createTime,lp.release_time AS releaseTime,lp.finish_time AS finishTime," +
                "(select count(ep.id) from bnz_exam_employee_paper ep where ep.paper_id=lsd.obj_id and ep.employee_id=ls.user_id) examCount,lsd.adopt_score as adoptScore,\n" +
                " (select max(ep.grade) from bnz_exam_employee_paper ep where ep.paper_id=lsd.obj_id and ep.employee_id=ls.user_id) grade,\n" +
                " (select max(ep.create_time) from bnz_exam_employee_paper ep where ep.paper_id=lsd.obj_id and ep.employee_id=ls.user_id) lastExamTime\tFROM\t\tbnz_learning_student ls\n" +
                " LEFT JOIN bnz_learning_plan lp ON ls.plan_id = lp.id LEFT JOIN bnz_learning_stage_detail lsd ON lsd.id = ls.stage_detail_id \n" +
                " where lsd.study_type=2 ";
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            whereSQL += "and lp.create_time BETWEEN '" + startDate + " 00:00:00' and  '" + endDate + "  23:59:59'";
        }
        whereSQL += "GROUP BY lsd.id) a where a.userId=" + userId + "";
        if (BNZConstants.TYPE_ONE.equals(type)) {
            whereSQL += " and a.examCount = 0";
        }
        if (BNZConstants.TYPE_TWO.equals(type)) {
            whereSQL += " and a.grade >= adoptScore";
        }
        if (BNZConstants.TYPE_THREE.equals(type)) {
            whereSQL += "  and a.grade < adoptScore";
        }
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL, "select count(1) from" + whereSQL, UserExamListVo.class);
        return queryBean;
    }

    public QueryHelpBean QueryUserExamCount(Long userId, String queryName, String startDate, String endDate) {
        String selectSQL = "SELECT count(1) allCount,sum( CASE a.examCount when 0 THEN 1 ELSE 0 END ) unFinish ,sum( CASE  when a.grade >= adoptScore THEN 1 ELSE 0 END ) finishCount," +
                "sum( CASE  when  a.grade < adoptScore THEN 1 ELSE 0 END ) unFinishCount ";
        String whereSQL = "FROM (SELECT ls.user_id userId,(SELECT count( ep.id ) FROM bnz_exam_employee_paper ep WHERE ep.paper_id = lsd.obj_id AND ep.employee_id = ls.user_id ) examCount,lsd.adopt_score AS adoptScore,\t( SELECT max( ep.grade ) FROM bnz_exam_employee_paper ep WHERE ep.paper_id = lsd.obj_id AND ep.employee_id = ls.user_id ) grade \n" +
                " FROM bnz_learning_student ls LEFT JOIN bnz_learning_plan lp ON ls.plan_id = lp.id LEFT JOIN bnz_learning_stage_detail lsd ON lsd.id = ls.stage_detail_id \n" +
                " WHERE lsd.study_type = 2 ";

        if (!StringUtils.isEmpty(queryName)) {
            whereSQL += "and lsd.obj_name like '" + queryName + "%'";
        }
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            whereSQL += " AND  lp.create_time BETWEEN '" + startDate + "  00:00:00' AND '" + endDate + " 23:59:59'";
        }

        whereSQL += " GROUP BY lsd.id ) a where a.userId=" + userId + "";
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL, "select count(1) from" + whereSQL, UserLearningListCount.class);
        return queryBean;
    }

    /*
     * @author liuwei
     * @date 2020/4/9 14:11
     * @desc 查询学员统计列表-课程列表sql
     */
    public QueryHelpBean QueryUserCourseQuery(Long userId, String startDate, String endDate) {
        String selectSQL = "select a.courseName,a.courseType,a.courseTypeName,a.createTime,IFNULL(a.learningHours,0) learningHours,a.lastStudyTime from ";
        String whereSQL = "(SELECT lsd.id,ls.user_id userId,ci.title AS courseName,ci.course_type courseType,(select name from bnz_sys_dictionary where id=ci.course_type) courseTypeName" +
                ",lp.release_time createTime,ls.learning_hours learningHours,ls.last_study_time lastStudyTime FROM\tbnz_learning_student ls " +
                "  LEFT JOIN bnz_learning_plan lp ON ls.plan_id = lp.id LEFT JOIN bnz_learning_stage_detail lsd ON lsd.id = ls.stage_detail_id left  join bnz_course_info ci" +
                " on lsd.obj_id=ci.id WHERE lsd.study_type = 0 and ls.user_id='" + userId + "'";
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            whereSQL += " AND  lp.create_time BETWEEN '" + startDate + "  00:00:00' AND '" + endDate + " 23:59:59'";
        }
        whereSQL += " GROUP BY lsd.id  ) a where 1=1 ";
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL, "select count(1) from" + whereSQL, UserLearningCourseListVo.class);
        return queryBean;
    }


    private static final List<Column> columns = new ArrayList<Column>();

    private static final List<Column> planColumns = new ArrayList<Column>();

    private static final List<Column> examColumns = new ArrayList<Column>();

    private static final List<Column> courseColumns = new ArrayList<Column>();

    /**
     * 员工学习统计报表
     */
    static {
        columns.add(new Column("cname", "姓名", 0));
        columns.add(new Column("name", "部门", 1));
        columns.add(new Column("jobType", "岗位分类", 2));
        columns.add(new Column("identity", "身份证", 3));
        columns.add(new Column("phone", "手机号", 4));
        columns.add(new Column("account", "工号", 5));
        columns.add(new Column("learningHours", "实际学时(min)", 6));
        columns.add(new Column("effectiveTime", "有效学时(min)", 7));
        columns.add(new Column("score", "总学分", 8));
        columns.add(new Column("courseCount", "已学课程", 9));
        columns.add(new Column("planCount", "学习计划", 10));
        columns.add(new Column("examCount", "考试", 11));
        columns.add(new Column("isRecord", "是否备案", 12));
        columns.sort(null);

    }

    public static List<Column> getColumnList() {
        return Collections.unmodifiableList(columns);
    }

    /**
     * 员工学习统计-学习计划明细
     */
    static {
        planColumns.add(new Column("objName", "学习计划", 0));
        planColumns.add(new Column("startDate", "开始时间", 1));
        planColumns.add(new Column("endDate", "结束时间", 2));
        planColumns.add(new Column("stateText", "状态", 3));
        planColumns.add(new Column("completionNum", "完成进度(%)", 4));
        planColumns.add(new Column("learningHours", "学习时长(min)", 5));
        planColumns.add(new Column("lastStudyTime", "最近学习时间", 6));
        planColumns.sort(null);
    }


    public static List<Column> getPlanColumnList() {
        return Collections.unmodifiableList(planColumns);
    }


    /**
     * 员工学习统计-考试列表明细
     */
    static {
        examColumns.add(new Column("examName", "考试名称", 0));
        examColumns.add(new Column("startDate", "开始时间", 1));
        examColumns.add(new Column("endDate", "结束时间", 2));
        examColumns.add(new Column("stateText", "状态", 3));
        examColumns.add(new Column("examCount", "考试次数", 4));
        examColumns.add(new Column("grade", "成绩", 5));
        examColumns.add(new Column("lastExamTime", "最近交卷时间", 6));
        examColumns.sort(null);
    }


    public static List<Column> getExamColumnList() {
        return Collections.unmodifiableList(examColumns);
    }

    /**
     * 员工学习统计-课程列表明细
     */
    static {
        courseColumns.add(new Column("courseName", "课程", 0));
        courseColumns.add(new Column("courseTypeName", "属性", 1));
        courseColumns.add(new Column("learningHours", "学习时长(min)", 2));
        courseColumns.add(new Column("lastStudyTime", "最近学习时间", 3));
        courseColumns.sort(null);
    }


    public static List<Column> getCourseColumnList() {
        return Collections.unmodifiableList(courseColumns);
    }


}
